DesktopFolder Function

Used to access to the desktop directory. The SpecialFolder object supports access to this and many other system special folders.

Syntax

result = DesktopFolder




Notes

Use the DesktopFolder function to access items on the desktop. Though they don't appear to be in a folder, in fact, all items on the desktop are in a directory or folder.

Windows

On Windows, DesktopFolder returns a FolderItem that references the Desktop directory for the current user: \Documents and Settings\user\Desktop, where user is the name of the currently-logged in user.

Macintosh

On Mac OS X, DesktopFolder returns a FolderItem that references the Desktop directory for the current user: /Users/user/Desktop:

Linux

On Linux, DesktopFolder tries to return the desktop folder for the current user's Window Manager. If there is a folder named "Desktop", it will return a FolderItem to that. Otherwise, if there is a folder in the current user's home directory named ".gnome-desktop", it will return a FolderItem to that.

Volumes and the Trash Can or Recycle Bin are not included in the Desktop Folder; however, desktop printers are. The Recycle Bin/Trash Can can be accessed via the TrashFolder function and the SpecialFolder's Trash property.


Example

This example displays the absolute path to the user's Desktop folder, if it exists on the user's machine.

Dim f As FolderItem
f=DesktopFolder
if f <> Nil Then
  MsgBox f.AbsolutePath
Else
  MsgBox "The folderItem does not exist."
End if

See Also

ApplicationSupportFolder, FontsFolder, PreferencesFolder, StartupItemsFolder, SystemFolder, TemporaryFolder, TrashFolder, SpecialFolder functions.